//
//  MerchsCollectionViewCell.m
//  gpos_app
//
//  Created by 崔航飞 on 2018/9/18.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "MerchsCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation MerchsCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setModels:(MerChantModel *)models{
    NSString *str;
    if (models.shop_headImage==nil) {
        str=@"";
    }else{
        
        str  = [NSString stringWithFormat:@"%@",models.shop_headImage];
    }
    
    // 对URL字符串进行 URL 编码，避免中文乱码问题
    //    NSString *urlStr = [models.pictuers stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSString *urlStr = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    self.topView.contentMode=UIViewContentModeScaleAspectFill;
    self.topView.clipsToBounds=YES;
    if (str==nil)
    {
        self.topView.image=[UIImage imageNamed:@"icon_sjt_zw"];
    }else{
        
        [self.topView sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:[UIImage imageNamed:@"icon_sjt_zw"]];
        
    }
    if ([models.name isMemberOfClass:[NSNull class]]) {
        self.Namelab.text=@"";

    }else{
        
        self.Namelab.text=[NSString stringWithFormat:@"%@",models.name];

    }
    if ([models.type isMemberOfClass:[NSNull class]]) {
        self.FLlab.text=@"";
    }else{
    if ([models.type isEqualToString:@"2"])
    {
         self.FLlab.text=@"美食";
    }else if ([models.type isEqualToString:@"3"]){
        
        self.FLlab.text=@"娱乐";
        
    }else if ([models.type isEqualToString:@"4"]){
        
         self.FLlab.text=@"购物";
        
    }else if ([models.type isEqualToString:@"5"]){
        
         self.FLlab.text=@"旅游";
    }else if ([models.type isEqualToString:@"6"]){
        
         self.FLlab.text=@"酒店";
    }else if ([models.type isEqualToString:@"1"]) {
        
        self.FLlab.text=@"全部";
    }
    }
    self.FLlab.layer.backgroundColor=[UIColor blueColor].CGColor;
    self.FLlab.layer.cornerRadius=3;
    if ([models.address isMemberOfClass:[NSNull class]])
    {
        self.addressLab.text=@"";
    }else{
    
        self.addressLab.text=[NSString stringWithFormat:@"%@",models.address];

    }
    if ([models.phone isMemberOfClass:[NSNull class]]) {
        self.phoneNum.text=@"";

    }else{
        self.phoneNum.text=[NSString stringWithFormat:@"%@",models.phone];

        
    }
    
}
@end
